<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>固定定位</title>
    <style>
        * {padding: 0; margin: 0;}
        .w { width: 1200px; margin: 0 auto;}
        .header { height: 200px; background-color: #bfa;}
        .main  { height: 2000px; background-color: tomato;}
        .footer { height: 500px; background-color: gray;}

        /* 固定在版心的相对位置, 常用法: 贴在版心右侧底部 */
        .dialog {
            position: fixed;
            margin-left: 50%;
            top: 50%;
            left: 600px;
            width: 50px;
            height: 100px;
            background-color: orange;
            border: 2px solid pink;
        }
    </style>
</head>
<body>
    <div class="dialog"></div>
    <!-- 固定定位: 固定在可视窗口的某个位置(偏移计算) -->
    <div class="header"></div>
    <div class="main w"></div>
    <div class="footer"></div>
</body>
</html>